<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Set mnoGoSearch agent session parameters</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.udm-set-agent-param" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">udm_set_agent_param</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.5, PHP 5 &lt; 5.1.0, PECL mnogosearch &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">udm_set_agent_param</span> &mdash; <span class="dc-title">Set mnoGoSearch agent session parameters</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.udm-set-agent-param-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>udm_set_agent_param</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$agent</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$var</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$val</code></span>
   ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   Defines mnoGoSearch session parameters.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.udm-set-agent-param-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">agent</code></dt>

     <dd>

      <p class="para">
       A link to Agent, received after call to
       <span class="function"><a href="udm_alloc_agent.html" class="function">udm_alloc_agent()</a></span>.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">var</code></dt>

     <dd>

      <p class="para">
       The following parameters and their values are available:
       <ul class="itemizedlist">
        <li class="listitem">
         <span class="simpara">
          <strong><code>UDM_PARAM_PAGE_NUM</code></strong> - used to choose search results page number (results
          are returned by pages beginning from 0, with <strong><code>UDM_PARAM_PAGE_SIZE</code></strong> results per page).
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>UDM_PARAM_PAGE_SIZE</code></strong> - number of search results displayed on one page.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>UDM_PARAM_SEARCH_MODE</code></strong> - search mode. The following values available: <strong><code>UDM_MODE_ALL</code></strong> -
          search for all words; <strong><code>UDM_MODE_ANY</code></strong> - search for any word; <strong><code>UDM_MODE_PHRASE</code></strong> -
          phrase search; <strong><code>UDM_MODE_BOOL</code></strong> - boolean search. See <span class="function"><a href="udm_find.html" class="function">udm_find()</a></span>
          for details on boolean search.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>UDM_PARAM_CACHE_MODE</code></strong> - turns on or off search result cache mode.
          When enabled, the search engine will store
          search results to disk. In case a similar search is performed later,
          the engine will take results from the cache for faster performance.
          Available values: <strong><code>UDM_CACHE_ENABLED</code></strong>,
          <strong><code>UDM_CACHE_DISABLED</code></strong>.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>UDM_PARAM_TRACK_MODE</code></strong> - turns on or off trackquery mode. Since
          version 3.1.2 mnoGoSearch has a query tracking support.
          Note that tracking is implemented in SQL version only and not available
           in built-in database.
          To use tracking, you have to create tables for tracking support.
          For MySQL, use <var class="filename">create/mysql/track.txt</var>.
          When doing a search, front-end uses those tables to store query words,
          a number of found documents and current Unix timestamp in seconds.
          Available values: <strong><code>UDM_TRACK_ENABLED</code></strong>,
          <strong><code>UDM_TRACK_DISABLED</code></strong>.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>UDM_PARAM_PHRASE_MODE</code></strong> - defines whether index database using phrases
          (&quot;phrase&quot; parameter in indexer.conf).
          Possible values: <strong><code>UDM_PHRASE_ENABLED</code></strong> and <strong><code>UDM_PHRASE_DISABLED</code></strong>.
          Please note, that if phrase search is enabled (<strong><code>UDM_PHRASE_ENABLED</code></strong>),
          it is still possible to do search in any mode (<em>ANY</em>, <em>ALL</em>,
          <em>BOOL</em> or <em>PHRASE</em>).
          In 3.1.10 version of mnoGoSearch phrase search is supported only in sql
          and built-in database modes,
          while beginning with 3.1.11 phrases are supported in cachemode as well.
         </span>
         <span class="simpara">
          Examples of phrase search:
         </span>
         <span class="simpara">
          <em>&quot;Arizona desert&quot;</em> - This query returns all indexed documents that contain
          &quot;Arizona desert&quot; as a phrase. Notice that you need to put double quotes
          around the phrase
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>UDM_PARAM_CHARSET</code></strong> - defines local charset. Available values: set of
          charsets supported by mnoGoSearch, e.g. koi8-r, cp1251, ...
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>UDM_PARAM_STOPFILE</code></strong> - Defines name and path
          to stopwords file.  (There is a small difference with mnoGoSearch
          - while in mnoGoSearch if relative path or no path entered, it
          looks for this file in relation to <strong><code>UDM_CONF_DIR</code></strong>, the module looks for
          the file in relation to current path, i.e. to the path where the
          PHP script is executed.)
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>UDM_PARAM_STOPTABLE</code></strong> - Load stop words from the given SQL table. You may use
          several StopwordTable commands.
          This command has no effect when compiled without SQL database support.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>UDM_PARAM_WEIGHT_FACTOR</code></strong> - represents weight factors for specific document parts.
          Currently body, title, keywords, description, url are supported.
          To activate this feature please use degrees of 2 in *Weight commands of
          the <var class="filename">indexer.conf</var>. Let&#039;s imagine that we have these weights:
         </span>
         <pre class="literallayout">
      URLWeight     1
      BodyWeight    2
      TitleWeight   4
      KeywordWeight 8
      DescWeight    16
         </pre>
     
         <span class="simpara">
          As far as indexer uses bit OR operation for word weights when some
          word presents several time in the same document, it is possible at search
          time to detect word appearance in different document parts. Word which
          appears only in the body will have 00000010 aggregate weight (in binary notation).
          Word used in all document parts will have 00011111 aggregate weight.
         </span>
     
         <span class="simpara">
          This parameter&#039;s value is a string of hex digits <em>ABCDE</em>. Each digit is a
          factor for corresponding bit in word weight. For the given above weights
          configuration:
         </span>
         <pre class="literallayout">
       E is a factor for weight 1  (URL Weight bit)
       D is a factor for weight 2  (BodyWeight bit)
       C is a factor for weight 4  (TitleWeight bit)
       B is a factor for weight 8  (KeywordWeight bit)
       A is a factor for weight 16 (DescWeight bit)
         </pre>
         <span class="simpara">
          Examples:
         </span>
         <span class="simpara">
          <strong><code>UDM_PARAM_WEIGHT_FACTOR</code></strong>=00001 will search through URLs only.
         </span>
         <span class="simpara">
          <strong><code>UDM_PARAM_WEIGHT_FACTOR</code></strong>=00100 will search through Titles only.
         </span>
         <span class="simpara">
          <strong><code>UDM_PARAM_WEIGHT_FACTOR</code></strong>=11100 will search through Title,Keywords,Description
          but not through URL and Body.
         </span>
         <span class="simpara">
          <strong><code>UDM_PARAM_WEIGHT_FACTOR</code></strong>=F9421 will search through:
         </span>
         <pre class="literallayout">
        Description with factor 15  (F hex)
        Keywords with factor 9
        Title with factor  4
        Body with factor 2
        URL with factor 1
         </pre>
         <span class="simpara">
          If <strong><code>UDM_PARAM_WEIGHT_FACTOR</code></strong> variable is omitted, original weight value is
          taken to sort results. For a given above weight configuration it means
          that document description has a most big weight 16.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>UDM_PARAM_WORD_MATCH</code></strong> - word match. You may use this parameter to choose
          word match type. This feature works only in &quot;single&quot; and &quot;multi&quot; modes
          using SQL based and built-in database. It does not work in cachemode and other modes
          since they use word CRC and do not support substring search. Available values:
         </span>
         <span class="simpara"><strong><code>UDM_MATCH_BEGIN</code></strong> - word beginning match;</span>
         <span class="simpara"><strong><code>UDM_MATCH_END</code></strong> - word ending match;</span>
         <span class="simpara"><strong><code>UDM_MATCH_WORD</code></strong> - whole word match;</span>
         <span class="simpara"><strong><code>UDM_MATCH_SUBSTR</code></strong> - word substring match.</span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>UDM_PARAM_MIN_WORD_LEN</code></strong> - defines minimal word length.
          Any word shorter this limit is considered to be a stopword. Please note
          that this parameter value is inclusive, i.e. if <strong><code>UDM_PARAM_MIN_WORD_LEN</code></strong>=3,
          a word 3 characters long will not be considered a stopword, while
          a word 2 characters long will be. Default value is 1.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>UDM_PARAM_ISPELL_PREFIXES</code></strong> - Possible values: <strong><code>UDM_PREFIXES_ENABLED</code></strong> and
          <strong><code>UDM_PREFIXES_DISABLED</code></strong>, that respectively enable or disable using prefixes.
          E.g. if a word &quot;tested&quot; is in search query, also words like &quot;test&quot;,
          &quot;testing&quot;, etc. Only suffixes are supported by default. Prefixes usually
          change word meanings, for example if somebody is searching for the word &quot;tested&quot;
          one hardly wants &quot;untested&quot;  to be found. Prefixes support may also be
          found useful for site&#039;s spelling checking purposes. In order to enable
          ispell, you have to load ispell data with <span class="function"><a href="udm_load_ispell_data.html" class="function">udm_load_ispell_data()</a></span>.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>UDM_PARAM_CROSS_WORDS</code></strong> - enables or disables crosswords support.
          Possible values: <strong><code>UDM_CROSS_WORDS_ENABLED</code></strong> and <strong><code>UDM_CROSS_WORDS_DISABLED</code></strong>.
         </span>
         <span class="simpara">
          The crosswords feature allows to assign words between &lt;a href=&quot;xxx&quot;&gt; and &lt;/a&gt;
          also to a document this link leads to. It works in SQL database mode and
          is not supported in built-in database and Cachemode.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>UDM_PARAM_VARDIR</code></strong> - specifies a custom path to directory where indexer
          stores data when using built-in database and in cache mode.
          By default <em>/var</em> directory of
          <span class="application">mnoGoSearch</span> installation is used. Can have
          only string values.
         </span>
        </li>
       </ul>
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">val</code></dt>

     <dd>

      <p class="para">
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.udm-set-agent-param-changelog">
  <h3 class="title">更新日志</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>4.1.0</td>
       <td>
        <strong><code>UDM_PARAM_VARDIR</code></strong> was added.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.udm-set-agent-param-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.udm-set-agent-param-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <span class="simpara">
    Crosswords are supported only in <span class="application">mnoGoSearch</span> 3.1.11 or later.
   </span>
  </p></blockquote>
 </div>


</div></div></div></body></html>